﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class fabuxinxi : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        TextBox1.Text = Session["userid"].ToString();
        TextBox2.Text = DateTime.Now.ToString();
        TextBox1.Enabled = false;
        TextBox2.Enabled = false;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        string sqlconn = ConfigurationManager.ConnectionStrings["infoConnectionString"].ConnectionString;
        SqlConnection conn = new SqlConnection(sqlconn);
        string userid = TextBox1.Text.Trim();
        string date = TextBox2.Text.Trim();
        string biaoti = TextBox3.Text.Trim();

        if (DropDownList1.SelectedValue == "0")
        {
            string cmdtext = "insert into b_infobook (user_id,user_datepb,user_pbmsg) values ('" + userid + "','" + date + "','" + biaoti + "')";
            conn.Open();
            SqlCommand cmd=new SqlCommand(cmdtext,conn);
            cmd.ExecuteNonQuery();
            Label1.Text="插入成功";
            TextBox1.Text = string.Empty;
            TextBox2.Text = string.Empty;
            TextBox3.Text = string.Empty;
            conn.Close();
        }
        if (DropDownList1.SelectedValue == "1")
        {
            string cmdtext = "insert into b_infoelc (user_id,user_datepb,user_pbmsg) values ('" + userid + "','" + date + "','" + biaoti + "')";
            conn.Open();
            SqlCommand cmd=new SqlCommand(cmdtext,conn);
            cmd.ExecuteNonQuery();
            Label1.Text="插入成功";
            TextBox1.Text = string.Empty;
            TextBox2.Text = string.Empty;
            TextBox3.Text = string.Empty;
            conn.Close();
        }
        if (DropDownList1.SelectedValue == "2")
        {
            string cmdtext = "insert into b_infohelp (user_id,user_datepb,user_pbmsg) values ('" + userid + "','" + date + "','" + biaoti + "')";
            conn.Open();
            SqlCommand cmd=new SqlCommand(cmdtext,conn);
            cmd.ExecuteNonQuery();
            Label1.Text="插入成功";
            TextBox1.Text = string.Empty;
            TextBox2.Text = string.Empty;
            TextBox3.Text = string.Empty;
            conn.Close();
        }
        if (DropDownList1.SelectedValue == "3")
        {
            string cmdtext = "insert into b_infoteach (user_id,user_datepb,user_pbmsg) values ('" + userid + "','" + date + "','" + biaoti + "')";
            conn.Open();
            SqlCommand cmd=new SqlCommand(cmdtext,conn);
            cmd.ExecuteNonQuery();
            Label1.Text="插入成功";
            TextBox1.Text = string.Empty;
            TextBox2.Text = string.Empty;
            TextBox3.Text = string.Empty;
            conn.Close();
        }
        TextBox1.Text = Session["userid"].ToString();
        TextBox2.Text = DateTime.Now.ToString();
        
    }
}
